package hongcaosp.app.android.modle.impl;

import com.lzy.okgo.OkGo;
import com.lzy.okgo.model.HttpParams;

import hongcaosp.app.android.BuildConfig;
import hongcaosp.app.android.modle.BaseResponse;
import hongcaosp.app.android.modle.DataCallBack;
import hongcaosp.app.android.modle.bean.Pagebean;
import hongcaosp.app.android.modle.mi.OnlineModel;
import hongcaosp.app.android.video.online.bean.OnlineMusic;
import hongcaosp.app.android.video.online.bean.OnlineRankWrap;

public class OnlineModelImpl implements OnlineModel {

    @Override
    public void list(String token, DataCallBack<OnlineRankWrap> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/music/list").params(params).execute(dataCallBack);
    }

    @Override
    public void rankList(String token, int id, int pageNumber, int pageSize, DataCallBack<Pagebean<OnlineMusic>> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("id", id);
        params.put("pageNumber", pageNumber);
        params.put("pageSize", pageSize);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/music/rankList").params(params).execute(dataCallBack);
    }

    @Override
    public void search(String token, String content, int pageNumber, int pageSize, DataCallBack<Pagebean<OnlineMusic>> dataCallBack) {
        HttpParams params = new HttpParams();
        params.put("token", token);
        params.put("content", content);
        params.put("pageNumber", pageNumber);
        params.put("pageSize", pageSize);
        OkGo.<BaseResponse>post(BuildConfig.HOST + "/api/music/search").params(params).execute(dataCallBack);
    }
}
